local Luahuoyanjinjing = fk.CreateSkill{
    name = "Luahuoyanjinjing",
    anim_type = "control",
  }
  
  Fk:loadTranslationTable{
    ["Luahuoyanjinjing"] = "火眼金睛",
    ["#Luahuoyanjinjing"] = "你可观看一名目标手牌，并弃置一种花色的手牌。",
    [":Luahuoyanjinjing"] = "出牌阶段限一次，你可观看一名目标手牌，并弃置一种花色的手牌。若累计弃置四种花色。可选择一项：1：可任选一名目标翻面。并对其造成三火焰伤害；2额外获得一回合。",
    ["#Luahuoyanjinjing-obtain"] = "火眼金睛：选择弃置 %src 的一种花色的手牌",
    ["hyjj1"] = "令一名角色翻面，并对其造成三火焰伤害",
    ["hyjj2"] = "获得一个额外的回合",
    ["@Luahuoyanjinjing"] = "火眼金睛",
    ["#Luahuoyanjinjing-target"] = "火眼金睛：选择一名角色其翻面，你对其造成3点火焰伤害。",
  }
  
  local U = require "packages/utility/utility"
  
  Luahuoyanjinjing:addEffect("active", {
    prompt = "#Luahuoyanjinjing",
    
    can_use = function(self, player)
      return player:usedSkillTimes(Luahuoyanjinjing.name, Player.HistoryPhase) == 0
    end,
    
    card_filter = Util.FalseFunc,
    
    target_filter = function(self, player, to_select, selected, cards)
      return #selected == 0 and to_select ~= player and not to_select:isKongcheng()
    end,
    target_num = 1,
    
    on_use = function(self, room, effect)
      local player = effect.from
      local target = effect.tos[1]
      -- 获取目标的手牌
      local cards = target.player_cards[Player.Hand]
      local availableCards = table.filter(cards, function(id)
          return true
      end)
      local get, _ = U.askforChooseCardsAndChoice(player, availableCards, {"OK"}, self.name, "#Luahuoyanjinjing-obtain", nil, 1, 1, cards)
      if #get > 0 then
        local card_names = {}
        for _, id in ipairs(target:getCardIds("h")) do
            if Fk:getCardById(id).suit == Fk:getCardById(get[1]).suit then
                table.insert(card_names, id)
            end
        end
        if #card_names > 0 then
            local dummy = Fk:cloneCard("dilu")
            dummy:addSubcards(card_names)
            room:throwCard(dummy,Luahuoyanjinjing.name,target,player)
        end
        if not table.contains(player:getTableMark("@Luahuoyanjinjing"),  Fk:getCardById(get[1]):getSuitString(true)) then
            player.room:addTableMark(player, "@Luahuoyanjinjing", Fk:getCardById(get[1]):getSuitString(true))
        end
      end
      if #player:getTableMark("@Luahuoyanjinjing") >= 4 then
        room:setPlayerMark(player, "@Luahuoyanjinjing", 0)
        local choice = player.room:askToChoice(player, {
            choices = {"hyjj1","hyjj2"},
            skill_name = Luahuoyanjinjing.name,
        })
        if choice == "hyjj1" then
            local targets = room:askToChoosePlayers(player, {
                targets = room:getAlivePlayers(),
                min_num = 1,
                max_num = 1,
                skill_name = Luahuoyanjinjing.name,
                prompt = "#Luahuoyanjinjing-target",
                cancelable = false,
            })
            targets[1]:turnOver()
            room:damage({
              from = player,
              to = targets[1],
              damage = 3,
              damageType = fk.FireDamage,
              skillName = Luahuoyanjinjing.name
            })
        else
            player:gainAnExtraTurn(true, Luahuoyanjinjing.name)
        end
      end
    end,
  })
  
  return Luahuoyanjinjing 